package cn.mw.cmdb.enums;

public enum DateTypeEnum {
    hours(1),
    twelveHours(6),
    days(2),
    weeks(3),
    months(4),
    custom(5);
    private Integer code;

    DateTypeEnum(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public static DateTypeEnum getDateTypeEnum(Integer code){
        for (DateTypeEnum dateTypeEnum : values()) {
            if (code.equals(dateTypeEnum.getCode())) {
                return dateTypeEnum;
            }
        }
        return hours;
    }
}
